<!DOCTYPE html>
<html>
<head>
    <title>用户登录</title>
    <style>
        body {
            margin: 0;
            padding: 0;
            font-family: 'Segoe UI', sans-serif;
            background: #f0f2f5;
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .register-section {
            text-align: center;
            margin-top: 25px;
            padding-top: 20px;
            border-top: 1px solid #eee;
        }

        .register-link {
            color: #6c5ce7;
            text-decoration: none;
            font-size: 14px;
            transition: color 0.3s;
        }

        .register-link:hover {
            color: #5b4bc4;
            text-decoration: underline;
        }

        .login-container {
            background: white;
            padding: 40px;
            border-radius: 12px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
            width: 100%;
            max-width: 400px;
            transition: transform 0.2s;
            margin-bottom: 20px;
        }

        .login-container:hover {
            transform: translateY(-2px);
        }

        h2 {
            color: #2d3436;
            text-align: center;
            margin-bottom: 30px;
            font-size: 24px;
        }

        form {
            display: flex;
            flex-direction: column;
            gap: 20px;
        }

        input {
            padding: 12px;
            border: 1px solid #ddd;
            border-radius: 6px;
            font-size: 16px;
            transition: border-color 0.3s;
        }

        input:focus {
            outline: none;
            border-color: #6c5ce7;
            box-shadow: 0 0 0 2px rgba(108, 92, 231, 0.2);
        }

        input::placeholder {
            color: #999;
        }

        button {
            background: #6c5ce7;
            color: white;
            padding: 12px;
            border: none;
            border-radius: 6px;
            font-size: 16px;
            cursor: pointer;
            transition: background 0.3s;
        }

        button:hover {
            background: #5b4bc4;
        }

        .error-message {
            text-align: center;
            margin-top: 15px;
        }
    </style>
</head>
<body>
    <div class="login-container">
        <h2>欢迎登录</h2>
        <form method="post">
            {% csrf_token %}
            <input type="text" name="username" placeholder="请输入用户名" required>
            <input type="password" name="password" placeholder="请输入密码" required>
            <button type="submit">立即登录</button>
        </form>

        <div class="register-section">
            <span>没有账号？</span>
            <a href="{% url 'register_page' %}" class="register-link">立即注册</a>
        </div>

        {% if error %}
            <p class="error-message" style="color: #ff4757;">{{ error }}</p>
        {% endif %}
    </div>
</body>
</html>